<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/10/22
 * Time: 16:01
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\common\business;


use app\common\validate\Address as ValObj;
use app\common\model\mysql\Address as ModelObj;
use think\Exception;
use think\facade\Log;

class Address extends Base
{
    /**
     * @var ValObj
     */
    protected ValObj $valObj;
    /**
     * @var ModelObj
     */
    protected ModelObj $modelObj;

    /**
     *
     */
    public function __construct()
    {
        $this->valObj = new ValObj();
        $this->modelObj = new ModelObj();
    }

    /**
     * @param string $openid
     * @param string $field
     * @return array
     * @throws Exception
     */
    public function getAddressByOpenidList(string $openid = '', string $field = '*'): array
    {
        try {
            $data = $this->modelObj->getAddressByOpenidList($openid, $field);
        } catch (\Exception $e) {
            throw new Exception("查询失败");
        }
        return $data;
    }
}